﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AETools
{

    public class LandType
    {
        public int dlbm;
        public string name = "";
        public LandType(int a, string b)
        {
            dlbm = a;
            name = b;
        }
    }

    public class Land
    {
        public int x = 0;
        public int y = 0;
        public double[] totalDemand = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
        public double[] fitness = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
        public List<double> XFactors = new List<double>();
        public int value = 0;
        public Land(int a, int b)
        {
            x = a;
            y = b;
        }
        public Land(int a, int b, int c)
        {
            x = a;
            y = b;
            value = c;
        }
    }

    public class LogisticFactor
    {
        public int landBM;
        public double a;//常数项
        public List<double> b;//自变量的参数
        public LogisticFactor()
        {
            landBM = 0;
            a = 0;
            b = new List<double>();
        }
        public LogisticFactor(int land, double a1, List<double> b1)
        {
            landBM = land;
            a = a1;
            b = b1;
        }
    }

    public class Position
    {
        int x;
        int y;
        public Position(int a, int b)
        {
            x = a;
            y = b;
        }
    }

    //警度
    public class WarnLevel
    {
        public double level0;
        public double level1;
        public double level2;
        public double level3;
        public double level4;
        public double level5;

        public WarnLevel(double min, double a, double b, double c, double d, double max)
        {
            level0 = min;
            level1 = a;
            level2 = b;
            level3 = c;
            level4 = d;
            level5 = max;
        }
        /// <summary>
        /// 根据输入值判断其属于那个警度
        /// </summary>
        /// <param name="a"></param>
        /// <returns></returns>
        public int GetLevel1(double a)
        {
            if (a <= level1)
                return 1;
            else if (a > level1 && a <= level2)
                return 2;
            else if (a > level2 && a <= level3)
                return 3;
            else if (a > level3 && a <= level4)
                return 4;
            else
                return 5;
        }

        public singleWarnLevel GetSingleLevel(int i)
        {
            if (i == 1)
                return new singleWarnLevel(level0, level1);
            else if (i == 2)
                return new singleWarnLevel(level1, level2);
            if (i == 3)
                return new singleWarnLevel(level2, level3);
            if (i == 4)
                return new singleWarnLevel(level3, level4);
            else
                return new singleWarnLevel(level4, level5);

        }
    }

    public class singleWarnLevel
    {
        public double low;
        public double high;
        public double GetLength()
        { return high - low; }
        public singleWarnLevel(double a, double b)
        {
            if (a >= b)
            {
                high = a;
                low = b;
            }
            else
            {
                low = a;
                high = b;
            }

        }
        public bool In(double x)
        {
            if ((x - low) * (x - high) > 0)
                return false;
            else
                return true;
        }
    }
    public class RoadObject
    {
        public string Name;
        public List<double> Indicators = new List<double>();
        public RoadObject(string name)
        {
            Name = name;
        }
    }

    /// <summary>
    /// POI对象类，包括POI的更重属性，CountsPerHour代表该poi每个时间的签到次数
    /// </summary>
    public class POIGroupByTime
    {
        public List<string> values;
        public Dictionary<int, int> CountsPerHour;
        public POIGroupByTime()
        {

            values = new List<string>();
            CountsPerHour = new Dictionary<int, int>();
            for (int i =0; i <= 23; i++)
            {
                CountsPerHour.Add(i, 0);
            }
        }
    }
}
